﻿using System.Collections.Generic;
using EDMDesigner.Business.Util;
using System.Linq;

namespace EDMDesigner.Business.Util
{
    public interface INamedElement
    {
        string Name { get; set; }
    }

}

namespace System
{
    public static class EnumerableOfNamedElementExtension
    {
        public static T GetByName<T>(this IEnumerable<T> source, string name) where T : INamedElement
        {
            return source.FirstOrDefault(item => item.Name == name);
        }
    }
}
